IF OBJECT_ID('ssf.log_info_failed') IS NOT NULL
	DROP VIEW ssf.log_info_failed
GO

CREATE VIEW ssf.log_info_failed
AS
SELECT log_id
	, source_object
	, task
	, task_description
	, target_object
	, log_sql
	, begin_spid
	, begin_login
	, begin_log_time
	, end_log_time
	, DATEDIFF(SECOND, begin_log_time, end_log_time) AS duration_ss
	, row_count
	, log_error_number
	, log_error_line
	, log_error_message
	, end_spid
	, end_login
FROM ssf.log_info WITH (NOLOCK)
WHERE end_log_time IS NOT NULL
AND ISNULL(log_error_number, 1) <> 0
GO
